package geometry;

import java.awt.Point;

public class CPoint extends Point {
    public int x, y;
    
    public void rotate(int cx, int cy, int dir) {
        int cos, sin, tx, ty;
        
        cos = (int) Math.round(Math.cos(dir * Math.PI/2));
        sin = (int) Math.round(Math.sin(dir * Math.PI/2));
        
        x -= cx;
        y -= cy;
        
        tx = x;
        ty = y;
        
        x =  tx * cos + ty * sin;
        y = -tx * sin + ty * cos;
        
        x += cx;
        y += cy;
    }
}
